package com.xgpro.mobile.archives.controller;


import com.xgpro.common.results.ResponseResult;
import com.xgpro.mobile.archives.service.ArchivesService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;



@RestController
@CrossOrigin(allowCredentials="true")
@RequestMapping("/archives")
public class ArchivesController {
    
    @Autowired
    private ArchivesService archivesService;

    //个人档案
    @GetMapping(value = "/getFileDetails")
    public ResponseResult getFileDetails(HttpServletRequest request){
           return archivesService.getFileDetails(request);
    }


    //职级
    @GetMapping(value = "/getRank")
    public ResponseResult getRank(HttpServletRequest request,String queue,Integer sort){
        return archivesService.getRank(request,queue,sort);
    }

    //职称
    @GetMapping(value = "/getTitleInfo")
    public ResponseResult getTitleInfo(HttpServletRequest request){
        return archivesService.getTitleInfo(request);
    }


    //发明专利
    @GetMapping(value = "/getPanentInfo")
    public ResponseResult getPanentInfo(HttpServletRequest request,Integer type){
        return archivesService.getPanentInfo(request,type);
    }

    //发明专利详情
    @GetMapping(value = "/getPanent")
    public ResponseResult getPanent(Integer id){
        return archivesService.getPanent(id);
    }

    //项目经验
    @GetMapping(value = "/getProject")
    public ResponseResult getProject(HttpServletRequest request,Integer projectlevel){
        return archivesService.getProject(request,projectlevel);
    }

    //项目详情
    @GetMapping(value = "/getProjectInfo")
    public ResponseResult getProjectInfo(Integer id){
        return archivesService.getProjectInfo(id);
    }

    //绩效
    @GetMapping(value = "/getPer")
    public ResponseResult getPer(HttpServletRequest request){
        return archivesService.getPer(request);
    }


    //上课时间and听课时间
    @GetMapping(value = "/getTimes")
    public ResponseResult getTime(HttpServletRequest request){
        return archivesService.getTimes(request);
    }

    //审批
    @PutMapping(value = "/setApproval")
    public ResponseResult setApproval(HttpServletRequest request){
        return archivesService.setApproval(request);
    }

    //六西格玛
    @GetMapping(value = "/getSix")
    public ResponseResult getSix(HttpServletRequest request){
        return archivesService.getSix(request);
    }

    @GetMapping(value = "/approval")
    public ResponseResult approval(HttpServletRequest request){
        return archivesService.approval(request);
    }

    @PostMapping("/picture")
    public ResponseResult picture(@RequestParam("file") MultipartFile file, HttpServletRequest request){
        return archivesService.picture(file,request);
    }

}